<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-model</title>
    <script src="../js/vue2.js"></script>
</head>
<body>
    <div id="app">
        用户名：<input type="text" name="" id="" v-model="loginData.userName"><br>
        密码：<input type="text"  name="" id="" v-model= "loginData.pass"><br>
        <input type="button" value="提交" @click="login">
        <!-- <input type="button" value="{{loginData.userName}}">
        <input type="button" value="{{loginData.pass}}"> -->

        <p>用户名是：{{loginData.userName}}</p>
        <p>密码是：{{loginData.pass}}</p>

    </div>
</body>
<script>
    // 创建Vue对象
    var ms=new Vue({
        // 指定模板app
        el:"#app",
        // 指定数据模板data
        data:{
            loginData:{
                userName:'',
                pass:''
            }
        },
        methods: {
            login(){
                console.log(this.loginData)
            }
        }

    })
</script>

</html>